﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace mozhi.smarterp.AuthorCenter.Migrations
{
    public partial class _202412161500 : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropColumn(
                name: "ConcurrencyStamp",
                table: "AbpPermissionItem");

            migrationBuilder.DropColumn(
                name: "ExtraProperties",
                table: "AbpPermissionItem");

            migrationBuilder.CreateTable(
                name: "AbpPermissionGroup",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
                    Code = table.Column<string>(type: "varchar(255)", nullable: true)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Name = table.Column<string>(type: "varchar(255)", nullable: true)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Type = table.Column<int>(type: "int", nullable: false),
                    PermissionGroupId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    ExtraProperties = table.Column<string>(type: "longtext", nullable: true)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ConcurrencyStamp = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: true)
                        .Annotation("MySql:CharSet", "utf8mb4")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AbpPermissionGroup", x => x.Id);
                    table.ForeignKey(
                        name: "FK_AbpPermissionGroup_AbpPermissionGroup_PermissionGroupId",
                        column: x => x.PermissionGroupId,
                        principalTable: "AbpPermissionGroup",
                        principalColumn: "Id");
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateIndex(
                name: "IX_AbpPermissionGroup_Code_Name_Type",
                table: "AbpPermissionGroup",
                columns: new[] { "Code", "Name", "Type" },
                unique: true);

            migrationBuilder.CreateIndex(
                name: "IX_AbpPermissionGroup_PermissionGroupId",
                table: "AbpPermissionGroup",
                column: "PermissionGroupId");
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "AbpPermissionGroup");

            migrationBuilder.AddColumn<string>(
                name: "ConcurrencyStamp",
                table: "AbpPermissionItem",
                type: "varchar(40)",
                maxLength: 40,
                nullable: true)
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<string>(
                name: "ExtraProperties",
                table: "AbpPermissionItem",
                type: "longtext",
                nullable: true)
                .Annotation("MySql:CharSet", "utf8mb4");
        }
    }
}
